package comgame.entities;

public class Farmland {
    private int row, col;
    private String cropType; // "WHEAT", "POTATO", "TOMATO"
    private boolean watered;
    private boolean fertilized;
    private boolean grown;
    private boolean tilled;
    private long matureTimestamp = 0; // 预计成熟时间戳（毫秒）

    public Farmland(int row, int col) {
        this.row = row;
        this.col = col;
        this.cropType = null;
        this.watered = false;
        this.fertilized = false;
        this.grown = false;
        this.tilled = false;
    }

    // getters/setters
    public int getRow() { return row; }
    public int getCol() { return col; }
    public String getCropType() { return cropType; }
    public void setCropType(String cropType) { this.cropType = cropType; }
    public boolean isWatered() { return watered; }
    public void setWatered(boolean watered) { this.watered = watered; }
    public boolean isFertilized() { return fertilized; }
    public void setFertilized(boolean fertilized) { this.fertilized = fertilized; }
    public boolean isGrown() { return grown; }
    public void setGrown(boolean grown) { this.grown = grown; }
    // 保留唯一一份isTilled和setTilled方法
    public boolean isTilled() { return tilled; }
    public void setTilled(boolean tilled) { this.tilled = tilled; }
    public long getMatureTimestamp() { return matureTimestamp; }
    public void setMatureTimestamp(long ts) { matureTimestamp = ts; }
    public void reset() {
        cropType = null;
        watered = false;
        fertilized = false;
        grown = false;
        tilled = false;
    }

    // 新增：判断是否有作物
    public boolean hasCrop() {
        return cropType != null;
    }
}
